import { configureStore } from "@reduxjs/toolkit";
import cart from "./modules/cart";
import React from "react";
import { persistStore,persistReducer } from "redux-persist";
import storage from 'redux-persist/lib/storage'

const persistConfigCarts = {
    key:'carts',
    storage,
    whitelist:['UserMessage','collectGoodList','collectBusinessList','historyList','ids','bz','dailist']
}

const persistedReducerCarts = persistReducer(persistConfigCarts,cart)
export const store = configureStore({
    reducer:{
        carts:persistedReducerCarts
    },
    middleware: (getDefaultMiddleware) => getDefaultMiddleware({
        serializableCheck: false, 
    })
})
export const persistor = persistStore(store)